home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Fatted Calf
/
The Fatted Calf.iso
/
Applications
/
GraphicViewers
/
Viewer_Yacktman
/
Source
/
Controller.m
< prev
next >
Wrap
Text File
|
1991-10-07
|
2KB
|
96 lines
/* Generated by Interface Builder */
#import "Controller.h"
@implementation Controller
- init
{
pics = 0;
first = YES;
nextX = 200;
nextY = 600;
return self;
}
- openImage:sender
{
const char *const *files;
char *file;
const char *dir;
static const char *const ft[2] = {"pic", NULL};
id openPanel = [OpenPanel new];
[openPanel allowMultipleFiles:NO];
if (first) {
[openPanel runModalForDirectory:"/Users/don/raytrace/ohta-tracer"
file:NULL types:ft];
first = NO;
}
else [openPanel runModalForTypes:ft];
files = [openPanel filenames];
dir = [openPanel directory];
file = malloc(strlen(files[0]) + strlen(dir) + 8);
strcpy(file, dir);
strcat(file,"/");
strcat(file, files[0]);
strcat(file, "\0");
[self openFile:file];
return self;
}
- saveImage:sender
{
if ([[SavePanel new] runModalForDirectory:[[OpenPanel new] directory]
file:"UNTITLED.tiff"]) {
[[[[NXApp keyWindow] contentView] findViewWithTag:69]
saveFile:[[SavePanel new] filename]];
}
return self;
}
- (BOOL)openFile:(const char *)name
{
id alert;
BOOL rStat;
[NXApp loadNibSection:"Window.nib" owner:self withNames:NO];
[newWindow setTitleAsFilename:name];
alert = NXGetAlertPanel(NULL, "Filling buffer and creating image.",
NULL, NULL, NULL);
[alert makeKeyAndOrderFront:self];
rStat = [newImage loadFile:name x:nextX y:nextY];
[alert orderOut:self];
[alert free];
nextX += 22; nextY -= 25;
if (nextX > 370) {
nextX = 200; nextY = 600;
}
if (rStat == YES) {
[saveBut setEnabled:YES];
}
return rStat;
}
- info:sender
{
if (!infoPanel)
[NXApp loadNibSection:"Info.nib" owner:self withNames:NO];
[infoPanel makeKeyAndOrderFront:self];
return self;
}
- (int)app:sender openFile:(const char *)file type:(const char *)type
{
return [self openFile:file];
}
- (BOOL)appAcceptsAnotherFile:sender
{
//if (pics < 16) { pics++; return YES; }
return YES;
}
@end